{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Examples\n",
    "\n",
    "Below are examples of predictions with OpenPifPaf's command line tool \n",
    "{ref}`openpifpaf.predict <cli-help-predict>`. These examples can serve as \n",
    "a starting point to create pose predictions on your own images.\n",
    "\n",
    "\n",
    "## COCO\n",
    "\n",
    "Below are example predictions from the COCO val set.\n",
    "These are the first images with more than five person annotations that were \n",
    "shared with [CC-BY-2.0].\n",
    "These examples are not cherry-picked.\n",
    "\n",
    "All examples are predicted with the fast model `shufflenetv2k16`.\n",
    "For more accurate results, try `--checkpoint=shufflenetv2k30`.\n",
    "\n",
    "[CC-BY-2.0]: https://creativecommons.org/licenses/by/2.0/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%bash\n",
    "python -m openpifpaf.predict coco/000000188465.jpg --image-output --long-edge=1025"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import IPython\n",
    "IPython.display.Image('coco/000000188465.jpg.predictions.jpeg')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Image credit: [Photo](https://www.flickr.com/photos/jelonekphotography/4593328722/) by Brian Jelonek shared under [CC-BY-2.0]."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%bash\n",
    "python -m openpifpaf.predict coco/000000114907.jpg --image-output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco/000000114907.jpg.predictions.jpeg')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Image credit: [Photo](https://www.flickr.com/photos/fortrucker/7825237468/) by Fort Rucker shared under [CC-BY-2.0]."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%bash\n",
    "python -m openpifpaf.predict coco/000000147740.jpg --image-output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco/000000147740.jpg.predictions.jpeg')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Image credit: [Photo](https://www.flickr.com/photos/cumidanciki/8026451116/) by CCFoodTravel.com shared under [CC-BY-2.0]."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%bash\n",
    "python -m openpifpaf.predict coco/000000541055.jpg --image-output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco/000000541055.jpg.predictions.jpeg')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Image credit: [Photo](https://www.flickr.com/photos/12407269@N07/3465325303/) by Jarrod Doll shared under [CC-BY-2.0]."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "(example-debug)=\n",
    "## Debug Outputs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%bash\n",
    "python -m openpifpaf.predict coco/000000541055_cropped.jpeg --image-output --debug-indices cif:5 cifhr:5 caf:5 --save-all=coco_debug_example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco_debug_example/0001.jpeg')  # cif:5:confidence"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco_debug_example/0002.jpeg')  # cif:5:regression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco_debug_example/0005.jpeg')  # cifhr:5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco_debug_example/0003.jpeg')  # caf:5:confidence"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "IPython.display.Image('coco_debug_example/0004.jpeg')  # caf:5:regression"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Image credit: [Photo](https://www.flickr.com/photos/12407269@N07/3465325303/) by Jarrod Doll shared under [CC-BY-2.0]."
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "ea6946363a43e80d241452ab397f4c58bdd3d2517da174158e9c46ce6717422a"
  },
  "kernelspec": {
   "display_name": "Python 3.9.4 64-bit ('venv3': venv)",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": ""
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
